package com.hqj.controller;

import com.hqj.service.OssService;
import com.hqj.utils.ResultUtil;
import com.hqj.utils.ResultVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author 黄啟军
 * @version 1.0
 * @date 2020/7/19 0019
 */
@RestController
@RequestMapping("file")
@CrossOrigin
public class OssController {
    @Resource
    private OssService ossService;
    @ApiOperation("文件上传")
    @PostMapping("/uploadOssFile")
    public ResultVO<String> uploadOssFile(MultipartFile file){
        //获取上传文件
        //返回上传后地址
        String ossFile = ossService.uploadOssFile(file);
        return ResultUtil.success(ossFile);
    }
}
